package JAVA1114;

import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

class Person  {
    public String name;
    public int age;
    public Person(String name,int age){
        this.name = name;
        this.age = age;//父类构造用this引用当前对象
        System.out.println("构造方法执行");
    }
    {
        System.out.println("实例化代码执行");
    }
    static{
        System.out.println("静态代码执行块");
    }
}
class Student extends Person{
    public Student(String name,int age){
        super(name, age);//子类构造用super继承父类部分成员的引用
        System.out.println("构造方法执行");
    }
    {
        System.out.println("实例代码块执行");
    }
    static{
        System.out.println("静态代码块执行");
    }
}
public class four{
    public static void main(String[] args) {
        Student student1 = new Student("hanmeimei",18);
        Student student2 = new Student("lileilei",22);
    }
}
//1，父类和子类静态代码块先后在开始执行，并且只执行一次，
//创建一次对象就会重新实例->构造
//创建对象一，父1实例，父1构造
//创建对象二，父2实例，父2构造
